<?php

namespace App\Http\Controllers\Api\V2;

use App\Http\Requests\ApiV2\ReplyRequest;
use App\Services\Designer\Services\ERPUserService;
use App\Services\Gallery\Interfaces\ClassicCaseServiceInterface;
use App\Services\Gallery\Model\ClassicCase;
use App\Services\Gallery\Services\ClassicCaseService;
use DfaFilter\SensitiveHelper;
use Illuminate\Http\Request;

class ClassicCaseController extends BaseController
{
    /**
     * @var ClassicCaseService
     */
    protected $classicCaseService;

    /**
     * @var ReplyService
     */
    protected $replyService;

    /**
     * @var ERPUserService
     */
    protected $ERPUserService;

    public function __construct(ClassicCaseServiceInterface $classicCaseService)
    {
        $this->classicCaseService = $classicCaseService;
    }

    public function index(Request $request)
    {
        $data = $request->all();
        $data['is_show'] = ClassicCase::SHOW_YES;
        $classicCases = $this->classicCaseService->index($data);
        $classicCases["data"] = arr2_clear($classicCases["data"], ["id", "title", "thumb",  "view_count", "sort", "type"]);
        return $this->data($classicCases);
    }

    public function detail($id)
    {
        $classicCase = $this->classicCaseService->detail($id);
        $classicCase = arr1_clear($classicCase, ["id", "title", "thumb", "describe", "content", "view_count", "sort", "type"]);
        return $this->data($classicCase);
    }
}
